package com.linwoain.wififileserver

import java.io.File
import java.math.BigInteger
import java.security.MessageDigest

/**
 * Created by linwoain on 2017/8/3.
 */

fun File.md5(): String {
    val md = MessageDigest.getInstance("MD5")
    this.forEachBlock { buffer, _ ->
        md.update(buffer)
    }
    val bigInteger = BigInteger(1, md.digest())
    return bigInteger.toString(16)
}